home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS in a Box 7
/
BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso
/
Files
/
Tele
/
C
/
Comet2.1.3.cpt
/
3270XCMD
/
TNClose.c
< prev
next >
Wrap
Text File
|
1990-03-19
|
1KB
|
81 lines
/* TNClose.c -- XCMD to close the TN3270 driver
copyright 1989 Cornell University
*/
#include <Types.h>
#include <Memory.h>
#include <Devices.h>
#include <HyperXCmd.h>
#include <Errors.h>
#include "TNdrvr.h"
pascal void debugger() extern 0xA9FF;
pascal void TNClose(hycp)
XCmdPtr hycp;
{
CntrlParam drvpb;
long * args;
Str255 pstr;
if (hycp->paramCount != 1) {
sethand(&hycp->returnValue, "TNClose TNID: need 1 argument");
return;
}
HLock((Handle) hycp->params[0]);
ZeroToPas(hycp, *hycp->params[0], (StringPtr) &pstr[0]);
drvpb.ioCRefNum = (short) StrToNum(hycp, (Str31 *) &pstr[0]);
drvpb.csCode = HTN_CLOSE;
PBControl((ParmBlkPtr) &drvpb, (Boolean) 0);
if (drvpb.ioResult) {
/* close call failed */
switch (drvpb.ioResult) {
case HTNR_NOTN: {
sethand(&hycp->returnValue, "TN is not running");
break;
}
case HTNR_ACTIVE: {
sethand(&hycp->returnValue, "TN not opened");
break;
}
case HTNR_OPEN: {
sethand(&hycp->returnValue, "TN has no connection");
break;
}
case badUnitErr: {
sethand(&hycp->returnValue, "TNID is incorrect");
break;
}
default: {
sethand(&hycp->returnValue, "Unknown error");
break;
}
}
}
HUnlock((Handle) hycp->params[0]);
return;
}
sethand(thand, str)
Handle * thand;
char * str;
{
if (*thand == NULL) {
*thand = NewHandle((Size) 0);
}
SetHandleSize(*thand, (long) (strlen(str) + 1));
strcpy(**thand, str);
}
#include <XCmdGlue.inc.c>